package com.motion.controller;

import com.motion.generator.entity.User;
import com.motion.provider.VideoProvider;
import com.motion.result.Result;
import com.motion.result.ResultFactory;
import io.swagger.annotations.Api;
import org.apache.tomcat.util.http.fileupload.FileUtils;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import java.io.File;
import java.io.IOException;

@RestController
@RequestMapping("/api/temp")
@Api("")
public class TempController {

    //压缩视频
    @RequestMapping(value = "/compressVideo", method = RequestMethod.POST)
    public void compressVideo(@RequestParam("source") MultipartFile source, @RequestParam("filename")String filename) throws IOException {
        File file=File.createTempFile("C://Users/lenovo/Desktop/temp", "mp4");
        source.transferTo(file);
        File compressedFile = VideoProvider.compressionVideo(file, filename);
    }

}
